package com.sk.weichat.bean;

import android.os.Parcel;
import android.os.Parcelable;

import com.j256.ormlite.field.DatabaseField;
import com.j256.ormlite.table.DatabaseTable;

@DatabaseTable
public class Label implements Parcelable {


    //标签总数
    public static final int MAX_COUNT = 20;
    @DatabaseField(generatedId = true)
    private int _id;

    @DatabaseField(canBeNull = false)
    private String userId;// 标签拥有者

    @DatabaseField
    private String groupId;// 标签Id

    @DatabaseField
    private String groupName;// 标签名字

    @DatabaseField
    private String userIdList;// 该标签下的用户id     [100,120]

    private boolean isSelected;// 该标签是否选中
    private boolean isSelectedInBelong;// 该标签是否选中

    public Label() {
    }

    protected Label(Parcel in) {
        _id = in.readInt();
        userId = in.readString();
        groupId = in.readString();
        groupName = in.readString();
        userIdList = in.readString();
        isSelected = in.readByte() != 0;
        isSelectedInBelong = in.readByte() != 0;
    }

    public static final Creator<Label> CREATOR = new Creator<Label>() {
        @Override
        public Label createFromParcel(Parcel in) {
            return new Label(in);
        }

        @Override
        public Label[] newArray(int size) {
            return new Label[size];
        }
    };

    public int get_id() {
        return _id;
    }

    public void set_id(int _id) {
        this._id = _id;
    }

    public String getUserId() {
        return userId;
    }

    public void setUserId(String userId) {
        this.userId = userId;
    }

    public String getGroupId() {
        return groupId;
    }

    public void setGroupId(String groupId) {
        this.groupId = groupId;
    }

    public String getGroupName() {
        return groupName;
    }

    public void setGroupName(String groupName) {
        this.groupName = groupName;
    }

    public String getUserIdList() {
        return userIdList;
    }

    public void setUserIdList(String userIdList) {
        this.userIdList = userIdList;
    }

    public boolean isSelected() {
        return isSelected;
    }

    public void setSelected(boolean selected) {
        isSelected = selected;
    }

    public boolean isSelectedInBelong() {
        return isSelectedInBelong;
    }

    public void setSelectedInBelong(boolean selectedInBelong) {
        isSelectedInBelong = selectedInBelong;
    }

    @Override
    public String toString() {
        return "Label{" +
                "_id=" + _id +
                ", userId='" + userId + '\'' +
                ", groupId='" + groupId + '\'' +
                ", groupName='" + groupName + '\'' +
                ", userIdList='" + userIdList + '\'' +
                ", isSelected=" + isSelected +
                ", isSelectedInBelong=" + isSelectedInBelong +
                '}';
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeInt(_id);
        dest.writeString(userId);
        dest.writeString(groupId);
        dest.writeString(groupName);
        dest.writeString(userIdList);
        dest.writeByte((byte) (isSelected ? 1 : 0));
        dest.writeByte((byte) (isSelectedInBelong ? 1 : 0));
    }
}
